package com.pomr.dao.test.impl;

import java.util.List;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.pomr.dao.test.DaoBase;
@Repository
public class DaoBaseImpl implements DaoBase{
	@Autowired
	private SessionFactory sessionFactory;

	@Override
	public void update(Object obj) {
		Session session = sessionFactory.openSession();
		session.update(obj);
	}

	@Override
	public void delete(Object obj) {
		Session session = sessionFactory.openSession();
		session.delete(obj);
	}

	@Override
	public List select(String sql) {
		Session session = sessionFactory.openSession();
		List list = session.createQuery(sql).list();
		return list;
	}

	@Override
	public void insert(Object obj) {
		Session session = sessionFactory.openSession();
		session.save(obj);
	}

}
